Skip to content

Conversation

antonysouthworth-halter
Copy link

@antonysouthworth-halter antonysouthworth-halter commented Sep 19, 2025

When using clangd it's not clear to me how you are supposed to tell it about -I and related flags.

I think we should add some basic pointers to the documentation for it.
Unfortunately, I don't actually know how to do this, would love to get some help with that!

@angelozerr
Copy link
Contributor

I need to improve doc but this doc is about using clangd language server to provide support with completion validation etc in editors for c, h, files not for building application.

Building application can be interesting with codelldb to debug c application by using the dap server from LSP4IJ and codelldb template

@antonysouthworth-halter
Copy link
Author

antonysouthworth-halter commented Oct 2, 2025

Yes I know it's not about building the application. My question is "how do I tell clangd (and by extension LSP4IJ) about the header files in my project so that completion/validation/etc. works?"

Maybe it's more clear with an example: Let's say I have some dependency vendored into my project at ./vendored/some-dep. When I build my app I use -I./vendored/some-app/include to make sure the compiler knows where to find them. But my editor doesn't have completion for anything I'm using from some-dep because clangd doesn't know to look there. How do I tell clangd to look there?

@angelozerr
Copy link
Contributor

@antonysouthworth-halter please share a simple project and tell me what you want to have. Thanks.

@angelozerr
Copy link
Contributor

@antonysouthworth-halter could you try something:

Go the the Installer tab and click on Run Installation:

image

If the installation can be done, it should work.

For instance given this hello.ccp file:

#include <iostream>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

If you open completion you should see

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants